package com.ruoyi.system.service.impl;

import java.util.List;
import java.util.Map;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.ItTopicMapper;
import com.ruoyi.system.domain.ItTopic;
import com.ruoyi.system.service.IItTopicService;

/**
 * 话题Service业务层处理
 *
 * @author ruoyi
 * @date 2022-01-26
 */
@Service
public class ItTopicServiceImpl implements IItTopicService {
    @Autowired
    private ItTopicMapper itTopicMapper;

    /**
     * 查询话题
     *
     * @param itId 话题主键
     * @return 话题
     */
    @Override
    public ItTopic selectItTopicByItId(String itId) {
        return itTopicMapper.selectItTopicByItId(itId);
    }

    /**
     * 查询话题列表
     *
     * @param itTopic 话题
     * @return 话题
     */
    @Override
    public List<ItTopic> selectItTopicList(ItTopic itTopic) {
        return itTopicMapper.selectItTopicList(itTopic);
    }

    /**
     * 查询热门话题排序话题列表
     *
     * @return 话题
     */
    @Override
    public List<Map<Object, Object>> selectItTopicListCount() {
        return itTopicMapper.selectItTopicListCount();
    }

    /**
     * 新增话题
     *
     * @param itTopic 话题
     * @return 结果
     */
    @Override
    public int insertItTopic(ItTopic itTopic) {
        itTopic.setCreateTime(DateUtils.getNowDate());
        return itTopicMapper.insertItTopic(itTopic);
    }

    /**
     * 修改话题
     *
     * @param itTopic 话题
     * @return 结果
     */
    @Override
    public int updateItTopic(ItTopic itTopic) {
        return itTopicMapper.updateItTopic(itTopic);
    }

    /**
     * 批量删除话题
     *
     * @param itIds 需要删除的话题主键
     * @return 结果
     */
    @Override
    public int deleteItTopicByItIds(String[] itIds) {
        return itTopicMapper.deleteItTopicByItIds(itIds);
    }

    /**
     * 删除话题信息
     *
     * @param itId 话题主键
     * @return 结果
     */
    @Override
    public int deleteItTopicByItId(String itId) {
        return itTopicMapper.deleteItTopicByItId(itId);
    }
}
